#ifndef STATEWDIGET_H
#define STATEWDIGET_H

#include <QWidget>
#include "global.h"
#include <QLabel>

class StateWdiget:public QWidget
{
    Q_OBJECT
public:
    StateWdiget(QWidget* parent = nullptr);
    void SetState(QString normal = "",QString hover = "",QString press = "",
                  QString select = "",QString select_hover = "",QString select_press = "");
    ClickLbState GetCurState();
    void ClearState();
    void setSelected(bool bselected);
    void AddRedPoint();
    void ShowRedPoint(bool show = true);
protected:
    virtual void mousePressEvent(QMouseEvent *event) override;
    virtual void mouseReleaseEvent(QMouseEvent *event) override;
    virtual void enterEvent(QEvent *event) override;
    virtual void leaveEvent(QEvent *event) override;
    virtual void paintEvent(QPaintEvent *event) override;
private:
    QString _normal;
    QString _hover;
    QString _press;
    QString _select;
    QString _select_hover;
    QString _select_press;
    ClickLbState _curstate;
    QLabel * _red_point;
signals:
    void clicked();
};

#endif // STATEWDIGET_H
